//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package common;

public class LogicRandom {
  private int iteratedRandomSeed;

  public LogicRandom() {
  }

  public int rand(int val) {
    if(val < 1) {
      return 0;
    } else {
      int seed = this.iteratedRandomSeed;
      if(seed == 0) {
        seed = -1;
      }

      seed ^= seed << 13;
      seed ^= seed >> 17;
      seed ^= seed << 5;
      this.iteratedRandomSeed = seed;
      if(seed <= -1) {
        seed *= -1;
      }

      return seed % val;
    }
  }

  public int getIteratedRandomSeed() {
    return this.iteratedRandomSeed;
  }

  public void setIteratedRandomSeed(int seed) {
    this.iteratedRandomSeed = seed;
  }
}
